
require('chromedriver');
const { Builder, By, Key, until } = require('selenium-webdriver');
var driver = new Builder().forBrowser('chrome').build();
//登录
function login() {
  driver.findElement(By.id("qlogin_list")).findElements(By.className("face")).then((arr) => {
    arr[0].click();
  });
  driver.sleep(2000).then(() => {
    driver.findElement(By.id('folder_1')).click();
    driver.sleep(2000).then(() => {
      // console.log(driver.getSession(),"Session")
      driver.manage().getCookies().then((res) => {
        console.log(res, "cookies")
      });
      
    })

  })
}
//退出登录
function loginOut() {
  // driver.findElements(By.className('toptitle')[2]).click();
}
//打开浏览器
driver.get("https://mail.qq.com/").then(() => {
  console.log("页面加载完成")
  iframe = driver.findElement(By.id("login_frame"))
  driver.switchTo().frame(iframe).then(() => {
    login();
  });
});

